package com.cong.collabox;

import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;
import android.content.Intent;
import android.text.style.UpdateAppearance;
import android.util.Log;
import android.view.Menu;
import android.widget.ImageView;
import android.widget.TextView;

public class MainActivity extends Activity {
	
	private Handler mHandler=new Handler();
	ImageView imageView;
	TextView textView;
	int alpha=255;
	int b=0;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		imageView=(ImageView)this.findViewById(R.id.ImageView01);
		textView=(TextView)this.findViewById(R.id.TextView01);
		Log.v("ColaBox", "ColaBox start...");
		imageView.setAlpha(alpha);
		
		new Thread(new Runnable() {
			
			@Override
			public void run() {
				initApp();
				
				while(b<2){
					try {
						if(b==0){
							Thread.sleep(1000);
							b=1;
						}else{
							Thread.sleep(50);
						}
						updateApp();
					} catch (Exception e) {
						// TODO: handle exception
					}
					
					
				}
				
			}
		});
		
	}

	protected void updateApp() {
		
		alpha-=5;
		if(alpha<=0){
			b=2;
			Intent in=new Intent(this,com.cong.collabox.);
		}
		
		
	}

	public void initApp() {
		BilldbHelper billdb=new BilldbHelper(this);
		billdb.FirstStart();
		billdb.close();
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	
}
